!{include file='common/iheader.htm'}
<style>
.option_div{position:absolute;width:98%;bottom:0;left:0;}
.cate_list_options{display:none;position:absolute;border:1px solid #AED0EA;background:white;}
.cate_list_options li{padding:3px 10px;cursor:pointer;}
.cate_list_options li:hover{background:#EBF4FA;}
#cate_list{display:none;}
</style>
<ul class="img_list">
!{foreach from=$files item=f key=k}
	<li file="!{$k}">
		<img src="!{res file=$f.path thumb=80x80}" class="auto_img"/>
		<div class="opt_div">
			<input type="checkbox" name="images[]" value="!{$k}">
			<a href="javascript:void(0)" onclick="del('!{$k}')">删除</a> | <a href="javascript:void(0);" class="move_link">移动</a><br/>
			!{if $f.cate}
			分类：<a href="/manager.php?app=file&act=files&cate=!{$f.cate}">!{$f.cate_name}</a>
			!{else}
			未分类
			!{/if}
		</div>
	</li>
!{foreachelse}
	<li>暂无!{$type_name}</li>
!{/foreach}
</ul>
<div class="option_div">
	<div class="pager">
	!{include file='common/pager.htm'}
	</div>
</div>
<ul id="cate_list">
!{foreach from=$cates item=cate key=cate_id}
	<li id="!{$cate_id}">!{$cate}</li>
!{/foreach}
</ul>
<script>
	$(function(){
		$(".move_link").drop_menu({
			ready : function(src, contner){
				var file = $(src).parents("li").attr("file");
				$("#cate_list li").click(function(){
					var cate = $(this).attr("id");
					$.post("/manager.php?app=file&act=move",
						{
							file : file,
							cate : cate
						},function(data){
						var json = eval('(' + data + ')');
						alert(json.info);
					});
					$("#cate_list li").unbind("click");
				});
				$(contner).html($("#cate_list").show());
			}
		});
	});

	function del(id){
		if(confirm('删除将可能造成引用它的地方失败，是否继续？')){
			$.get('/manager.php?app=file&act=del&id=' + id,function(data){
				var json = eval('('+data+')');
				alert(json.info);
				if(json.result){
					window.location.reload();
				}
			});
		}
	}
</script>
!{include file='common/ifooter.htm'}